<script>import { useUserStore } from '@/stores/user';

export default {
  setup() {
    const userStore = useUserStore();

    function login() {
      userStore.setUserInfo({ username: '张三', email: 'zhangsan@example.com' });
    }

    function logout() {
      userStore.logout();
    }

    return { userStore, login, logout };
  }
};
</script>

<template>
    <div v-if="userStore.isLoggedIn">
      欢迎你，{{ userStore.userInfo.userId }}
    </div>
</template>
<style scoped>

</style>